<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>引用animate动画函数</title>
    <style>
        
        .sliderbar {
            position: relative;
            left: 98%;
            width: 200px;
            height: 40px;
            background-color: pink;
            /* z-index: -1; */
        }
        .con {
            position: absolute;
            left: 0;
            top: 0;
            z-index: -1;
            width: 200px;
            height: 40px;
            background-color: pink;

        }
    </style>
    <script src="animate.js"></script>
</head>

<body>
    <div class="sliderbar">
        <span>←</span>
        <div class="con">问题反馈</div>
    </div>
    <script>
        var sliderbar = document.querySelector('.sliderbar')
        var con = document.querySelector('.con')
        // 鼠标移入触发
        sliderbar.addEventListener('mouseenter', function () {
            animate(con, -160, function(){
                // sliderbar 下面的第一个孩子
                // 函数执行完毕 把箭头更改
                sliderbar.children[0].innerHTML = '→'
            })
        })
        sliderbar.addEventListener('mouseleave', function () {
            animate(con, 0, function(){
                sliderbar.children[0].innerHTML = '←'
            })
        })
    </script>
</body>

</html>